<template>
  <div class="iframe_operation-analysis">
    <iframe ref="iframe" :src="src" class="iframe-container"></iframe>
  </div>
</template>

<script>
import api from '../../apis/operation-analysis'
const iframeModule = {
  'user-views': 'USER',
  'runtime-views': 'BOARD'
}
export default {
  data() {
    return {
      src: ''
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    getData() {
      const { path } = this.$route
      const urlList = path.split('/')
      api
        .getIframeUrl({
          pageCode: iframeModule[urlList[urlList.length - 1]] || 'USER'
        })
        .then(res => {
          this.src = res.url
        })
    }
  }
}
</script>

<style lang="scss" scoped>
.iframe_operation-analysis {
  margin: 24px;
  height: 100vh;
  background-color: #fff;
  .iframe-container {
    border: none;
    height: 100vh;
    width: 100%;
    background-color: #fff;
  }
}
</style>
